<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f = "http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"  
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Edit-RefPortal</title>
    </h:head> 
    <h:body> 
        <ui:composition template="./BannersAndMenusTemplate.jsf">

            <ui:define name="content">
                <h:form id="fromss" rendered="#{user.getlogin()}">
                    <p:panel header="Reference Details">
                        <h:panelGrid columns="2" title="Edit Reference Details:">    
                            <h:outputLabel  value="Title:" />  
                            <p:inputText value = "#{user.selectedReference.title}"/> 

                            <h:outputLabel  value="Year:" />  
                            <p:inputText  value="#{user.selectedReference.rYear}"   />

                            <h:outputLabel  value="Edition:" rendered="#{user.renderEdition}"/>  
                            <p:inputText  value="#{user.selectedReference.edition}"  rendered="#{user.renderEdition}"/>  
 

                            <h:outputLabel  value="City:" rendered="#{user.renderCity}"/>   
                            <p:inputText  value="#{user.selectedReference.city}"  rendered="#{user.renderCity}"/>

                            <h:outputLabel  value="Doi:" rendered="#{user.renderDoi}"/> 
                            <p:inputMask value="#{user.doi}" rendered="#{user.renderDoi}" mask="99.9999/?***********************************"/> 

                            <h:outputLabel  value="ISBN10:" rendered="#{user.renderIsbn}"/>     
                            <p:inputMask value="#{user.isbn10}" rendered="#{user.renderIsbn}" mask="9-99-999999-*"/> 

                            <h:outputLabel  value="ISBN13:" rendered="#{user.renderIsbn}"/>  
                            <p:inputMask value="#{user.isbn13}" rendered="#{user.renderIsbn}" mask="999-9-99-999999-*"/> 


                            <h:outputLabel  value="Pages:" rendered="#{user.renderPages}"/>  
                            <p:inputText  value="#{user.selectedReference.pages}"  rendered="#{user.renderPages}"/>


                            <h:outputLabel  value="Volume:" rendered="#{user.renderVolume}"/>  
                            <p:inputText  value="#{user.selectedReference.volume}"  rendered="#{user.renderVolume}"/>

                            <h:outputLabel  value="Issue:"  rendered="#{user.renderIssue}"/>  
                            <p:inputText  value="#{user.selectedReference.issue}"   rendered="#{user.renderIssue}"/>

                            <h:outputLabel  value="URL:"  rendered="#{user.renderUrl}"/>  
                            <p:inputText  value="#{user.selectedReference.address}"   rendered="#{user.renderUrl}"/>
                            
                            <h:outputLabel  value="Retrieve Date:" rendered="#{user.renderDate}"/>  
                            <p:calendar value="#{user.date2}" id="popupCal" rendered="#{user.renderDate}"/>

                            <p:dialog header="Selected Dates" widgetVar="dialog"   
                                      showEffect="fade" hideEffect="fade">  

                                <h:panelGrid id="display" columns="2" cellpadding="5">  

                                    <h:outputText value="Popup Date:" />  
                                    <h:outputText value="#{user.selectedReference.date}" id="popupDate">  
                                        <f:convertDateTime pattern="d/M/yyyy"/>  
                                    </h:outputText>   

                                </h:panelGrid>  

                            </p:dialog>   
                            
                            <h:outputLabel  value="" />   
 
                           

                            <h:outputLabel  value="Other:" />  
                            <p:inputText  value="#{user.selectedReference.other}"  />
                            
                            <h:outputLabel  value="Language:" />  
                            <p:selectOneMenu value="#{user.selectedReference.language}" panelStyle="width:150px"  
                                             effect="fade" var="p" style="width:160px"  filter="true" filterMatchMode="startsWith">  
                                <f:selectItem itemLabel="Select One" itemValue="" />  
                                <f:selectItems value="#{user.languages}" />  

                                  
                            </p:selectOneMenu> 

                            <h:outputLabel  value="Subject:" />  
                            <p:inputText  value="#{user.selectedReference.subject}"  />

                        </h:panelGrid>  
                        <p:commandButton id="saveButton3" value="Change" action = "#{user.editReference()}"/>  
                    </p:panel>     
                </h:form>
                <h:form rendered="#{user.login2}"> 
                    <a href="login.jsf">please log in again</a>
                </h:form>
            </ui:define>

        </ui:composition>


    </h:body>

</html>
